home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / comp / negate.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  577 b   |  24 lines

  1. /*
  2.                              N E G A T E . C
  3. */
  4.  
  5. #include "iccomp.h"
  6.  
  7. ESTRUC_ *negate(ESTRUC_ *e)                  /* expression so far */
  8. {
  9.     if (test_operand(e, op_umin))            /* test types ok */
  10.     {
  11.         semantic(illegal_type, opstring[op_umin]);
  12.         return (e);
  13.     }
  14.  
  15.     if (e->type & e_const)                  /* immediate value */
  16.         (int)e->evalue = -(int)e->evalue;
  17.     else
  18.     {
  19.         etoc(e);                            /* convert to code */
  20.         gencode(e, op_umin);                /* generate instruction */
  21.     }
  22.  
  23.     return (e);
  24. }